# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgbase=libshumate
pkgname=(
  libshumate
  libshumate-docs
)
pkgver=1.1.2
pkgrel=1
pkgdesc="Map widget for GTK 4"
url="https://wiki.gnome.org/Projects/libshumate"
license=(LGPL)
arch=(loong64 x86_64)
depends=(
  cairo
  glib2
  gtk4
  libsoup3
  sqlite
)
makedepends=(
  gi-docgen
  git
  gobject-introspection
  meson
  vala
)
checkdepends=(xorg-server-xvfb)
_commit=eeb257ab8cfca9133ec2e7da739d3ce815be7067  # tags/1.1.2^0
source=("git+https://gitlab.gnome.org/GNOME/libshumate.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  local meson_options=(
    -D demos=true
  )

  arch-meson $pkgname build "${meson_options[@]}"
  meson compile -C build
}

check() {
  GTK_A11Y=none dbus-run-session xvfb-run -s '-nolisten local' \
    meson test -C build --print-errorlogs
}

package_libshumate() {
  provides=(libshumate-1.0.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_libshumate-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
